﻿using AutoMapper;
using Sharp.DataTransferObject;
using Sharp.DataTransferObject.CMS;
using Sharp.Infrastructure.Interfaces;
using Sharp.WebBooter.Areas.CMS.Models;

namespace Sharp.WebBooter.Areas.CMS
{
    public class AutoMapperBootStrapper : IBootstrapPlugin
    {
        public void Initialize()
        {
            Mapper.Initialize(cfg =>
            {
                #region 用户
                cfg.CreateMap<UserDTO, UserViewModel>()
                    .ReverseMap();

                cfg.CreateMap<UserGroupDTO, UserGroupViewModel>()
                    .ReverseMap();

                cfg.CreateMap<PermissionDTO, PermissionViewModel>()
                    .ReverseMap();
                #endregion

                #region VIU
                cfg.CreateMap<VIUDTO, VIUViewModel>()
                    .ReverseMap();
                cfg.CreateMap<VIUDTO, VIUReViewViewModel>()
                    .ReverseMap();
                cfg.CreateMap<ColumnDTO, ColumnViewModel>()
                    .ReverseMap();
                cfg.CreateMap<VIUCategoryDTO, CategoryViewModel>()
                    .ReverseMap();
                cfg.CreateMap<FieldDTO, FieldViewModel>()
                    .ReverseMap();
                cfg.CreateMap<TagDTO, TagViewModel>()
                     .ReverseMap();
                cfg.CreateMap<NoiseWordDTO, NoiseWordViewModel>()
                          .ReverseMap();
                cfg.CreateMap<IPBlackListDTO, IPBlackListViewModel>()
                      .ReverseMap();
                cfg.CreateMap<ApproveHistoryDTO, VIUReViewViewModel>()
                      .ReverseMap();
                cfg.CreateMap<SpecialDTO, SpecialViewModel>()
                      .ReverseMap();
                cfg.CreateMap<ApproveHistory4SpecialDTO, SpecialReViewViewModel>()
                      .ReverseMap();
                cfg.CreateMap<SpecialDTO, SpecialReViewViewModel>()
                      .ReverseMap();
                cfg.CreateMap<GatherDTO, GatherViewModel>()
                  .ReverseMap();
                #endregion

                #region 基础库
                cfg.CreateMap<ArticleDTO, ArticleViewModel>()
                  .ReverseMap();
                #endregion

                #region 会员相关

                #endregion
            });
            this.IsAlready = true;
        }

        public bool IsAlready { get; set; }
    }
}